<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class ImgModel extends Model
{
    use HasFactory;
    protected $table = 'img';
    protected $primaryKey = 'id';
    public $timestamps = false;
    protected $fillable = [
        'id',
        'path',
        'created_at'
    ];

    public static function useImg($path) {
        self::where('path', $path)->delete();
    }

    public static function destoryImg() {
        self::where('created_at', '<', date('Y-m-d H:i:s', strtotime('-1 day')))->delete();
    }
}
